#!/usr/bin/env python

"""Izumi Konata

Username and password checker robot.

Args:
    facebook: check facebook username and password.
"""

import sys

sys.path.append('lib')

import argparse
import resource.string.argument as r

formatter_class = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(description=r.description, epilog=r.epilog,
                                 formatter_class=formatter_class,
                                 prog=r.name)

subParser = parser.add_subparsers()

# Facebook Parser
facebookParser = subParser.add_parser('facebook', epilog=r.epilog,
                                      description=r.facebook.description,
                                      help=r.facebook.help,
                                      formatter_class=formatter_class)
facebookSubParser = facebookParser.add_subparsers()

# Facebook Checker Parser
facebookCheckerParser = facebookSubParser.add_parser('check',
        description=r.facebook.checker.description,
        epilog=r.epilog, help=r.facebook.checker.help,
        formatter_class=formatter_class)
facebookCheckerParser.set_defaults(action='facebook.checker')
facebookCheckerParser.add_argument('filename', help=r.facebook.checker.filename)
facebookCheckerParser.add_argument('-d', '--delay', action="store", default=5,
                                   help=r.facebook.checker.delay, type=int)
facebookCheckerParser.add_argument('-f', '--silent', '--quiet', help=r.silent,
                                   action="store_true")
facebookCheckerParser.add_argument('-v', '--verbose', action="store_true",
                                   help=r.verbose)


args = parser.parse_args()
action = args.action

import shinon.facebook

app = None
if action == 'facebook.checker':
    app = shinon.facebook.Checker(args)

app.run()
del app
    